package test;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import expression.*;

public class ShermanSzetoPETest {

	@Before
	public void setUp() throws Exception {

	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void test1() {
		String test1 = "1 3 4 5 2 * 4 * * + 3 4 -5 10 - - + ";
		int answer = PostfixEvaluator.eval(test1);
		assertTrue(answer == 22);
	}

	@Test
	public void test2() {
		String test2 = "10 12 + 2 * 5 1 * + 1 - ";
		int answer = PostfixEvaluator.eval(test2);
		assertTrue(answer == 48);
	}

	@Test
	public void test3() {
		String test3 = "1 2 ^ 3 + 10 * 5 + 7 + 2 * 4 * 4 - 7 - 0 + 0 - ";
		int answer = PostfixEvaluator.eval(test3);
		assertTrue(answer == 405);
	}

	@Test
	public void test4() {
		String test4 = " 4 7 + 0 - 1 * 10 *";
		int answer = PostfixEvaluator.eval(test4);
		assertTrue(answer == 110);
	}

	@Test
	public void test5() {
		String test5 = "      0 0 +             0 -  0 *   0     0    + -    10   +   ";
		int answer = PostfixEvaluator.eval(test5);
		assertTrue(answer == 10);
	}

}
